home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
- <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
- <?xml-stylesheet href="chrome://webclipper3/skin/webclipperOverlay.css" type="text/css"?>
-
- <overlay id="webclipper3Overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
- <!-- common function to put the button in the toolbar the first go-round -->
- <script type="application/x-javascript" src="chrome://webclipper3-common/content/toolbar-button-init.js"/>
-
- <script type="application/x-javascript">
- <![CDATA[
- var window_clipped_to_en;
- ]]>
- </script>
- <script type="application/x-javascript" src="http://www.evernote.com/public/bookmarkClipper.js"/>
- <script type="application/x-javascript">
- <![CDATA[
- function evernote_addSelectionToEn3(popupSrc) {
- var br = document.getElementById("content");
- var wnd = null;
- if (br == null || !br.selectedTab || popupSrc)
- wnd = document.commandDispatcher.focusedWindow;
- else
- wnd = br.getBrowserForTab(br.selectedTab).docShell
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
- window_clipped_to_en = wnd;
- EN_CLIP_HOST='http://www.evernote.com';
- EN_clip(EN_CLIP_HOST);
- return true; // handled
- }
-
-
- function evernote_addToEn3(popupSrc) {
- // see also WhichPaneHasFocus() globally defined function
-
- //use globally defined functions
- try {
- var threadTree = GetThreadTree();
- } catch(e) {
- // GetThreadTree not exists in 'message opened' window
- return evernote_addSelectionToEn3(null);
- }
- if (top.document.commandDispatcher.focusedWindow == GetMessagePaneFrame())
- return evernote_addSelectionToEn3(popupSrc);
-
- var messagePane = GetMessagePane();
- var currentNode = top.document.commandDispatcher.focusedElement;
- while (currentNode) {
- if (currentNode === messagePane)
- return evernote_addSelectionToEn3(popupSrc);
- else if (currentNode === threadTree)
- return evernote_addSelectedMessagesToEn3();
- currentNode = currentNode.parentNode;
- }
- return evernote_addSelectionToEn3(null); //???
- }
-
- // uninit under FF/TB 1.5
-
- var evernote_uninstallObserver3 = {
- bUninstall:false,
- observe:function(subject, topic, data) {
- if (topic == "em-action-requested") {
- var item = subject.QueryInterface(Components.interfaces.nsIUpdateItem);
- // id from install.rdf <em:id>
- if(item.id == "{E0B8C461-F8FB-49b4-8373-FE32E9252800}") {
- if (data == "item-uninstalled"){
- this.bUninstall = true;
- } else if (data == "item-cancel-action") {
- this.bUninstall = false;
- }
- }
- } else if (topic == "quit-application-granted") {
- if (this.bUninstall) {
- var prefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPrefService);
- var db = prefs.getBranch(null);
- db.clearUserPref(evernote_preference3);
- }
- this.unregister();
- }
- },
- register:function() {
- var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
- observerService.addObserver(this, "em-action-requested", false);
- observerService.addObserver(this, "quit-application-granted", false);
- },
- unregister:function() {
- var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
- observerService.removeObserver(this,"em-action-requested");
- observerService.removeObserver(this,"quit-application-granted");
- }
- }
-
- function evernote_setObserver3() {
- evernote_uninstallObserver3.register();
- }
- window.addEventListener("load", evernote_setObserver3, false);
-
- ]]>
- </script>
-
-
- <!-- This is for the right click menu -->
-
- <!-- in Firefox -->
-
- <popup id="contentAreaContextMenu">
- <menuseparator id="webclipper-menu-sep" />
- <menuitem id="webclipper3-menu"
- label="Add to Evernote"
- oncommand="return evernote_addSelectionToEn3(document.popupNode);" />
- </popup>
-
- <!-- This is for the Tools menu -->
-
- <!-- in Firefox -->
-
- <menupopup id="menu_ToolsPopup">
- <menuseparator id="webclipper-menu-sep" />
- <menuitem id="webclipper3-menu"
- label="Add to Evernote"
- oncommand="return evernote_addSelectionToEn3(null);" />
- </menupopup>
-
- <!-- This is for the toolbar -->
-
- <!-- in Firefox -->
-
- <toolbarpalette id="BrowserToolbarPalette">
- <toolbarbutton id="webclipper3-button" label="Add to Evernote"
- class="toolbarbutton-1 chromeclass-toolbar-additional"
- tooltiptext="Add selected text or entire page to Evernote as new note"
- oncommand="return evernote_addSelectionToEn3(null);" />
- </toolbarpalette>
-
- </overlay>
-
-